<template>
  <view class="page-module__banner">
    <edu-swiper :list="datas.list" name="url" :height="280" @click="path"></edu-swiper>
  </view>
</template>

<script>
export default {
  props: {
    datas: {
      type: Object,
      default: () => {},
    },
  },
  methods: {
    path(index) {
      let item = this.datas.list[index]
      if (item.type == 1 && item.course_id) {
        // 跳课程详情
        this.$u.route('/pageCourse/course/details', {
          id: item.course_id,
        })
      } else if (item.type == 2 && item.href) {
        // #ifdef H5
        window.open(item.href)
        // #endif
        // #ifdef APP-PLUS
        plus.runtime.openURL(item.href)
        // #endif
      }
    },
  },
}
</script>

<style lang="scss" scoped>
.page-module__banner {
  margin-bottom: 32rpx;
  padding: 0 30rpx;
}
</style>
